package model

type Admission struct {
	ENo         string `gorm:"column:e_no"`
	Department  string `gorm:"column:department"`
	FirstGrade  int    `gorm:"column:firstgrade"`
	SecondGrade int    `gorm:"column:secondgrade"`
}

func GetAdmission(admissionparam map[string]interface{}) (error, []Admission, int64) {
	var admissiondata []Admission
	page := admissionparam["page"].(int)
	pageSize := admissionparam["limit"].(int)
	searchText := admissionparam["searchText"].(string)
	var total int64
	err := DB.Table("admissions").Where("e_no like ? ", "%"+searchText+"%").Count(&total).Offset((page - 1) * pageSize).Limit(pageSize).Find(&admissiondata).Error
	return err, admissiondata, total
}
